package com.xinan.system.meetwx;

import java.util.List;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

@TableBind(tableName = "wx_user")
public class WxUser extends Model<WxUser>{
	
	private static final long serialVersionUID = 1L;
	
    public static final WxUser dao = new WxUser();

    //columns START
    private String ID = "id";  //
    private String USERNAME = "username";  //昵称
    private String REALNAME = "realname";  //真实姓名
    private String PASSWORD = "password";  //密码
    private String CARDNO = "cardno";  //身份证号
    private String OPENID = "openid";  //openid
    private String WEIXINID = "weixinid";  //微信号
    private String EMAIL = "email";  //email
    private String TELPHONE = "telphone";  //手机号
    private String BANKID = "bankid";  //开户银行
    private String BANKNO = "bankno";  //银行卡号 
    private String CREATETIME = "createtime";  //创建时间
    private String CREATEID = "createid";  //创建者

    public void setId(int value) {
        set(ID, value);
    }

	public int getId() {
		return get(ID);
	}
    public void setUsername(String value) {
        set(USERNAME, value);
    }

	public String getUsername() {
		return get(USERNAME);
	}
    public void setRealname(String value) {
        set(REALNAME, value);
    }

	public String getRealname() {
		return get(REALNAME);
	}
    public void setPassword(String value) {
        set(PASSWORD, value);
    }

	public String getPassword() {
		return get(PASSWORD);
	}
    public void setCardno(String value) {
        set(CARDNO, value);
    }

	public String getCardno() {
		return get(CARDNO);
	}
    public void setOpenid(String value) {
        set(OPENID, value);
    }

	public String getOpenid() {
		return get(OPENID);
	}
    public void setWeixinid(String value) {
        set(WEIXINID, value);
    }

	public String getWeixinid() {
		return get(WEIXINID);
	}
    public void setEmail(String value) {
        set(EMAIL, value);
    }

	public String getEmail() {
		return get(EMAIL);
	}
    public void setTelphone(String value) {
        set(TELPHONE, value);
    }

	public String getTelphone() {
		return get(TELPHONE);
	}
    public void setBankid(int value) {
        set(BANKID, value);
    }

	public int getBankid() {
		return get(BANKID);
	}
    public void setBankno(String value) {
        set(BANKNO, value);
    }

	public String getBankno() {
		return get(BANKNO);
	}
    public void setCreatetime(String value) {
        set(CREATETIME, value);
    }

	public String getCreatetime() {
		return get(CREATETIME);
	}
    public void setCreateid(int value) {
        set(CREATEID, value);
    }

	public int getCreateid() {
		return get(CREATEID);
	}
	//columns END

    public List<WxUser> findAll() {
        return find("select * from wx_user");
    }
    /**
     * @param   where
     * @return  Record
     */
    public List<Record> findAlls(String where) {
        String sqlExp = " from wx_user";
        if(StrKit.notBlank(where)){
                sqlExp += " where " + where;
        }
                return Db.find( "select * " +sqlExp );

    }

    public Page<WxUser> page(int pageNumber, int pageSize, String where) {
        String sqlExp = "from wx_user";
        if(StrKit.notBlank(where)){
            sqlExp += " where " + where;
        }
        return paginate(pageNumber, pageSize, "select *", sqlExp);
    }
}

